<html>
<head>
<style>
  .ace_editor {
    border: 0;
    width: auto;
    height: 100%;
    margin: 0;
    top:0;
    right:0;
    bottom:0;
    left:0;
    z-index: 10000;
    touch-action: none;
  }

  body {
    padding: 0px;
    margin: 0px;
    overflow: hidden;
    -ms-overflow-style: scrollbar;
  }
</style>
</head>
<body>
<textarea id="source">package com.sencha.gxt.examples.resources.client;

import com.google.gwt.core.client.GWT;
import com.sencha.gxt.core.client.BindingPropertySet;
import com.sencha.gxt.core.client.BindingPropertySet.PropertyName;

public class Utils {

  public enum Theme {
    BLUE("Blue Theme", false), GRAY("Gray Theme", false), NEPTUNE("Neptune Theme", true), TRITON("Triton Theme", true);

    private final String title;
    private final boolean touch;

    private Theme(String title, boolean touch) {
      this.title = title;
      this.touch = touch;
    }

    public String getTitle() {
      return title;
    }

    public boolean isActive() {
      ActiveTheme theme = GWT.create(ActiveTheme.class);
      switch (this) {
      case BLUE:
        return theme.isBlue();
      case GRAY:
        return theme.isGray();
      case NEPTUNE:
        return theme.isNeptune();
      case TRITON:
        return theme.isTriton();
      }
      return false;
    }

    public boolean isTouch() {
      return touch;
    }

    @Override
    public String toString() {
      return getTitle();
    }
  }

  @PropertyName("gxt.theme")
  public interface ActiveTheme extends BindingPropertySet {
    @PropertyValue(value = "gray", warn = false)
    boolean isGray();

    @PropertyValue(value = "blue", warn = false)
    boolean isBlue();

    @PropertyValue(value = "neptune", warn = false)
    boolean isNeptune();

    @PropertyValue(value = "triton", warn = false)
    boolean isTriton();
  }

}
</textarea>

<script src="../../samples/ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
  var type = "{type}";
  if (type == ("{" + "type}")) {
    // something went wrong, use java as default
    type = "java";
  }
  var editor = ace.edit("source");
  var mode = "ace/mode/" + type;
  var theme = "ace/theme/chrome";
  var readOnly = true;
  editor.getSession().setMode(mode);
  editor.getSession().setUseWorker(false);
  editor.setTheme(theme);
  editor.setShowPrintMargin(false);
  editor.renderer.setShowGutter(true);
  editor.setHighlightActiveLine(false);
  editor.setDisplayIndentGuides(true);
  editor.setReadOnly(readOnly);
  editor.renderer.setPadding(10);
  editor.renderer.setScrollMargin(10, 10, 0, 0);
  editor.getSession().setOptions({
    tabSize: 8,
    useSoftTabs: true,
    useWrapMode: false,
  });
</script>
</body>
</html>